//
//  PPMeInfoSexCell.m
//  PropertyManage
//
//  Created by Dreamsoul on 15-3-26.
//  Copyright (c) 2015年 com.lab603.mc. All rights reserved.
//

#import "PPMeInfoSexCell.h"
#import "PPMeInfoSexCellFrame.h"
#import "PPMe.h"
@interface PPMeInfoSexCell()
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UIImageView *sexIcon;
@end
@implementation PPMeInfoSexCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *ID = @"meInfoSexCell";
    PPMeInfoSexCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell = [[PPMeInfoSexCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    return cell;

}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectedBackgroundView = [[UIView alloc] init];
        //设置背景图片
        UIImageView *backgroundView = [[UIImageView alloc] init];
        backgroundView.image = [UIImage resizedImageWithName:@"timeline_card_top_background"];
        backgroundView.highlightedImage = [UIImage resizedImageWithName: @"timeline_card_top_background_highlighted"];
        [self.contentView addSubview:backgroundView];
        self.backgroundView = backgroundView;
        //设置标题文字
        UILabel *titleLabel = [[UILabel alloc] init];
        [titleLabel setBackgroundColor:[UIColor clearColor]];
        [titleLabel setTextColor:[UIColor blackColor]];
        titleLabel.numberOfLines = 0;
        titleLabel.font = [UIFont systemFontOfSize:15.0];
        [self.backgroundView addSubview:titleLabel];
        self.titleLabel = titleLabel;
        //设置性别标志图片
        UIImageView *sexIcon = [[UIImageView alloc] init];
        [self.backgroundView addSubview:sexIcon];
        self.sexIcon = sexIcon;
        self.sexIcon.hidden = YES;
    }
    return self;
}
- (void)setInfoSexF:(PPMeInfoSexCellFrame *)infoSexF{
    _infoSexF = infoSexF;
    //设置frame
    self.titleLabel.frame = infoSexF.titleF;
    self.sexIcon.frame = infoSexF.sexIconF;
    self.backgroundView.frame = infoSexF.backgroundViewF;
    //设置数据
    self.titleLabel.text = infoSexF.me.titleString;
    self.sexIcon.image = [UIImage imageWithName:infoSexF.me.sexIcon];
    if (infoSexF.me.sexFlag) {
        self.sexIcon.hidden = NO;
    }
}
@end
